package com.zqsign.common.core.logging;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.alibaba.fastjson.JSON;

/**
 * @ClassName: BaseConLogger 
 * @Description（类信息描述）: Controller日志类
 *
 * @Company: zqsign
 * @date 2017年10月26日 上午11:32:50
 */
public class ZqConLogger implements ZqBaseLogger{
	
	//创建静态日志对象
	private Logger logger;
	
	//私有构造器
	protected ZqConLogger(){}
	protected ZqConLogger(Class clazz){
		logger = LoggerFactory.getLogger(clazz);
	}
	protected ZqConLogger(String s){
		logger = LoggerFactory.getLogger(s);
	}
	
	/*------------------------- debug -------------------------*/ 
	public void debug(String id,String project,String module,String function,String msg){
		logger.debug("编号:"+id+"本机ip:"+ZqLoggerUtil.getHostAddress()+","+CONTROLLER_INFO+"方法名："+ZqLoggerUtil.getMethodName()+",行号："+ZqLoggerUtil.getLineNumber()+",日志信息：{}", project, module, function, msg);
	}
	public void debug(String id,String project,String module,String function,Object obj){
		logger.debug("编号:"+id+"本机ip:"+ZqLoggerUtil.getHostAddress()+","+CONTROLLER_INFO+"方法名："+ZqLoggerUtil.getMethodName()+",行号："+ZqLoggerUtil.getLineNumber()+",日志信息：{}", project, module, function, JSON.toJSONString(obj));
	}
	public void debug(String id,String project,String module,String function,String msg,Throwable t){
		logger.debug("编号:"+id+"本机ip:"+ZqLoggerUtil.getHostAddress()+","+CONTROLLER_INFO+"方法名："+ZqLoggerUtil.getMethodName()+",行号："+ZqLoggerUtil.getLineNumber()+",日志信息：{},异常信息：{}", project, module, function, msg, t);
	}
	public void debug(String id,String project,String module,String function,String format,Object obj){
		logger.debug("编号:"+id+"本机ip:"+ZqLoggerUtil.getHostAddress()+","+CONTROLLER_INFO+"方法名："+ZqLoggerUtil.getMethodName()+",行号："+ZqLoggerUtil.getLineNumber()+",日志信息："+format, project, module, function, obj);
	}
	public void debug(String id,String project,String module,String function,String format,Object... args){
		//创建一个集成数组
		Object[] newArray = new Object[args.length+3];
		//调用工具类集成数组
		ZqLoggerUtil.formatLogInfo(args,newArray,project,module,function);
		logger.debug("编号:"+id+"本机ip:"+ZqLoggerUtil.getHostAddress()+","+CONTROLLER_INFO+"方法名："+ZqLoggerUtil.getMethodName()+",行号："+ZqLoggerUtil.getLineNumber()+",日志信息："+format, newArray);
	}
	
	/*------------------------- info -------------------------*/
	public void info(String id,String project,String module,String function,String msg){
		logger.info("编号:"+id+"本机ip:"+ZqLoggerUtil.getHostAddress()+","+CONTROLLER_INFO+"方法名："+ZqLoggerUtil.getMethodName()+",行号："+ZqLoggerUtil.getLineNumber()+",日志信息：{}", project, module, function, msg);
	}
	public void info(String id,String project, String module, String function, Object obj) {
		logger.info("编号:"+id+"本机ip:"+ZqLoggerUtil.getHostAddress()+","+CONTROLLER_INFO+"方法名："+ZqLoggerUtil.getMethodName()+",行号："+ZqLoggerUtil.getLineNumber()+",日志信息：{}", project, module, function, JSON.toJSONString(obj));
	}
	public void info(String id,String project,String module,String function,String msg,Throwable t){
		logger.info("编号:"+id+"本机ip:"+ZqLoggerUtil.getHostAddress()+","+CONTROLLER_INFO+"方法名："+ZqLoggerUtil.getMethodName()+",行号："+ZqLoggerUtil.getLineNumber()+",日志信息：{},异常信息：{}", project, module, function, msg, t);
	}
	public void info(String id,String project,String module,String function,String format,Object o){
		logger.info("编号:"+id+"本机ip:"+ZqLoggerUtil.getHostAddress()+","+CONTROLLER_INFO+"方法名："+ZqLoggerUtil.getMethodName()+",行号："+ZqLoggerUtil.getLineNumber()+",日志信息："+format, project, module, function, o);
	}
	public void info(String id,String project,String module,String function,String format,Object... args){
		//创建一个集成数组
		Object[] newArray = new Object[args.length+3];
		//调用工具类集成数组
		ZqLoggerUtil.formatLogInfo(args,newArray,project,module,function);
		logger.info("编号:"+id+"本机ip:"+ZqLoggerUtil.getHostAddress()+","+CONTROLLER_INFO+"方法名："+ZqLoggerUtil.getMethodName()+",行号："+ZqLoggerUtil.getLineNumber()+",日志信息："+format, newArray);
	}
	
	/*------------------------- warn -------------------------*/
	public void warn(String id,String project,String module,String function,String msg){
		logger.warn("编号:"+id+"本机ip:"+ZqLoggerUtil.getHostAddress()+","+CONTROLLER_INFO+"方法名："+ZqLoggerUtil.getMethodName()+",行号："+ZqLoggerUtil.getLineNumber()+",日志信息：{}", project, module, function, msg);
	}
	public void warn(String id,String project, String module, String function, Object obj) {
		logger.warn("编号:"+id+"本机ip:"+ZqLoggerUtil.getHostAddress()+","+CONTROLLER_INFO+"方法名："+ZqLoggerUtil.getMethodName()+",行号："+ZqLoggerUtil.getLineNumber()+",日志信息：{}", project, module, function, JSON.toJSONString(obj));
	}
	public void warn(String id,String project,String module,String function,String msg,Throwable t){
		logger.warn("编号:"+id+"本机ip:"+ZqLoggerUtil.getHostAddress()+","+CONTROLLER_INFO+"方法名："+ZqLoggerUtil.getMethodName()+",行号："+ZqLoggerUtil.getLineNumber()+",日志信息：{},异常信息：{}", project, module, function, msg, t);
	}
	public void warn(String id,String project,String module,String function,String format,Object o){
		logger.warn("编号:"+id+"本机ip:"+ZqLoggerUtil.getHostAddress()+","+CONTROLLER_INFO+"方法名："+ZqLoggerUtil.getMethodName()+",行号："+ZqLoggerUtil.getLineNumber()+",日志信息："+format, project, module, function, o);
	}
	public void warn(String id,String project,String module,String function,String format,Object... args){
		//创建一个集成数组
		Object[] newArray = new Object[args.length+3];
		//调用工具类集成数组
		ZqLoggerUtil.formatLogInfo(args,newArray,project,module,function);
		logger.warn("编号:"+id+"本机ip:"+ZqLoggerUtil.getHostAddress()+","+CONTROLLER_INFO+"方法名："+ZqLoggerUtil.getMethodName()+",行号："+ZqLoggerUtil.getLineNumber()+",日志信息："+format, newArray);
	}
	
	/*------------------------- error -------------------------*/
	public void error(String id,String project,String module,String function,String msg){
		logger.error("编号:"+id+"本机ip:"+ZqLoggerUtil.getHostAddress()+","+CONTROLLER_INFO+"方法名："+ZqLoggerUtil.getMethodName()+",行号："+ZqLoggerUtil.getLineNumber()+",日志信息：{}", project, module, function, msg);
	}
	public void error(String id,String project, String module, String function, Object obj) {
		logger.error("编号:"+id+"本机ip:" + ZqLoggerUtil.getHostAddress() + "," + CONTROLLER_INFO + "方法名：" + ZqLoggerUtil.getMethodName()+ ",行号：" + ZqLoggerUtil.getLineNumber() + ",日志信息：{}",project, module, function, JSON.toJSONString(obj));
	}
	public void error(String id,String project,String module,String function,String msg,Throwable t){
		logger.error("编号:"+id+"本机ip:"+ZqLoggerUtil.getHostAddress()+","+CONTROLLER_INFO+"方法名："+ZqLoggerUtil.getMethodName()+",行号："+ZqLoggerUtil.getLineNumber()+",日志信息：{},异常信息：{}", project, module, function, msg, t);
	}
	public void error(String id,String project,String module,String function,String format,Object o){
		logger.error("编号:"+id+"本机ip:"+ZqLoggerUtil.getHostAddress()+","+CONTROLLER_INFO+"方法名："+ZqLoggerUtil.getMethodName()+",行号："+ZqLoggerUtil.getLineNumber()+",日志信息："+format, project, module, function, o);
	}
	public void error(String id,String project,String module,String function,String format,Object... args){
		//创建一个集成数组
		Object[] newArray = new Object[args.length+3];
		//调用工具类集成数组
		ZqLoggerUtil.formatLogInfo(args,newArray,project,module,function);
		logger.error("编号:"+id+"本机ip:"+ZqLoggerUtil.getHostAddress()+","+CONTROLLER_INFO+"方法名："+ZqLoggerUtil.getMethodName()+",行号："+ZqLoggerUtil.getLineNumber()+",日志信息："+format, newArray);
	}
}
